<?php
/**
 * Copyright (c) 2018-2019.
 *  This file is part of the moonpie production
 *  (c) johnzhang <875010341@qq.com>
 *  This source file is subject to the MIT license that is bundled
 *  with this source code in the file LICENSE.
 */

use think\Env;
use think\Route;

$backend_group = Env::get('BACKEND_NAME', 'admin');
Route::group($backend_group, function() {
    Route::rule(['backend.basic_wechat_account_config', 'basic/wechat-account/config'], 'moonpie\plugin\wechat_account\controller\Index@index', 'get|post');
    Route::rule(['backend.basic_wechat_account_add', 'basic/wechat-account/add'], 'moonpie\plugin\wechat_account\controller\Index@addAccount', 'get|post');
    Route::rule(['backend.basic_wechat_account_edit', 'basic/wechat-account/edit'], 'moonpie\plugin\wechat_account\controller\Index@editAccount', 'get|post');
    Route::rule(['backend.basic_wechat_account_delete', 'basic/wechat-account/drop'], 'moonpie\plugin\wechat_account\controller\Index@addAccount', 'post');

    //接下来是公众号单独管理部分
    Route::rule(['backend.wechat_account_manage', 'wechat-account/profile/:account_id'], 'moonpie\plugin\wechat_account\controller\AccountSetting@profile', 'get|post');
    //保存公众号不同的配置项
    Route::post(['wechat_account.admin_save_account_config', 'wechat-account/service-config/:account_id'], 'moonpie\plugin\wechat_account\controller\AccountSetting@serviceConfig');
    //展示公众号模板部分
    Route::get(['wechat_account.admin_template_list', 'wechat-account/template/list/:account_id'], 'moonpie\plugin\wechat_account\controller\AccountSetting@templateList');
    Route::get(['wechat_account.admin_template_config_list', 'wechat-account/template-config/list/:account_id'], 'moonpie\plugin\wechat_account\controller\AccountSetting@templateConfigList');
    //测试公众号模板发送
    Route::rule(['wechat_account.admin_try_template_send', 'wechat-account/template/retry-send/:account_id/:tmpl_id'], 'moonpie\plugin\wechat_account\controller\AccountSetting@templateSend', 'get|post');

    //模板发送器部分
    Route::rule(['wechat_account.admin_template_config_manage', 'wechat-account/template-config/manage/:account_id/[:config_id]'], 'moonpie\plugin\wechat_account\controller\AccountSetting@templateSenderManage', 'get|post');

    //处理用户粉丝相关
    Route::get(['wechat_account.admin_fans_list', 'wechat-account/fans/list/:account_id/[:tag_id]'], 'moonpie\plugin\wechat_account\controller\AccountSetting@fans');
    //保存新标签
    Route::post(['wechat_account.admin_save_new_tag', 'wechat-account/fans/user-tag/create/:account_id'], 'moonpie\plugin\wechat_account\controller\AccountSetting@saveNewTag');
    //同步所有用户信息
    Route::any(['wechat_account.admin_sync_all_fans', 'wechat-account/fans/sync-all/:account_id'], 'moonpie\plugin\wechat_account\controller\AccountSetting@syncAllFans');
});
//添加被动服务功能
Route::rule(['frontend.wechat_account_serve', 'wechat-account/server/:app_id'], 'moonpie\plugin\wechat_account\controller\Guard@serve', 'get|post');